<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户{{ $user->telephone }} 数据统计页</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            color: #333;
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
        }

        header {
            text-align: center;
            padding: 30px 0;
            margin-bottom: 30px;
            animation: fadeInDown 1s ease;
        }

        header h1 {
            font-size: 2.5rem;
            color: #2c3e50;
            margin-bottom: 10px;
        }

        header p {
            color: #7f8c8d;
            font-size: 1.1rem;
        }

        .dashboard {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 25px;
            margin-bottom: 40px;
        }

        .card {
            background: white;
            border-radius: 15px;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
            padding: 25px;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            position: relative;
            overflow: hidden;
            animation: fadeInUp 0.5s ease;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
        }

        .card-header {
            display: flex;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid #eee;
        }

        .card-header i {
            font-size: 1.8rem;
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #3498db, #2980b9);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            margin-right: 15px;
        }

        .card-header h2 {
            color: #2c3e50;
            font-size: 1.4rem;
        }

        .data-item {
            display: flex;
            justify-content: space-between;
            padding: 12px 0;
            border-bottom: 1px dashed #eee;
        }

        .data-item:last-child {
            border-bottom: none;
        }

        .data-label {
            display: flex;
            align-items: center;
            color: #7f8c8d;
        }

        .data-label i {
            margin-right: 8px;
            font-size: 0.9rem;
        }

        .data-value {
            font-weight: 600;
            color: #2c3e50;
            font-size: 1.1rem;
        }

        .highlight {
            color: #e74c3c;
            font-weight: 700;
        }

        .chart-container {
            height: 200px;
            margin-top: 15px;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }

        .stat-card {
            background: white;
            border-radius: 12px;
            padding: 20px;
            text-align: center;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
        }

        .stat-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
        }

        .stat-value {
            font-size: 2rem;
            font-weight: 700;
            color: #3498db;
            margin: 10px 0;
        }

        .stat-label {
            color: #7f8c8d;
            font-size: 0.95rem;
        }

        footer {
            text-align: center;
            padding: 30px 0;
            color: #7f8c8d;
            font-size: 0.9rem;
            margin-top: 30px;
        }

        .watermark {
            position: absolute;
            bottom: 10px;
            right: 15px;
            opacity: 0.05;
            font-size: 5rem;
            font-weight: 800;
            pointer-events: none;
            color: #2c3e50;
        }

        .card:nth-child(1) .card-header i {
            background: linear-gradient(135deg, #3498db, #2980b9);
        }

        .card:nth-child(2) .card-header i {
            background: linear-gradient(135deg, #2ecc71, #27ae60);
        }

        .card:nth-child(3) .card-header i {
            background: linear-gradient(135deg, #e74c3c, #c0392b);
        }

        .card:nth-child(4) .card-header i {
            background: linear-gradient(135deg, #f39c12, #d35400);
        }

        .card:nth-child(5) .card-header i {
            background: linear-gradient(135deg, #9b59b6, #8e44ad);
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes fadeInDown {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .card:nth-child(1) {
            animation-delay: 0.1s;
        }

        .card:nth-child(2) {
            animation-delay: 0.2s;
        }

        .card:nth-child(3) {
            animation-delay: 0.3s;
        }

        .card:nth-child(4) {
            animation-delay: 0.4s;
        }

        .card:nth-child(5) {
            animation-delay: 0.5s;
        }

        @media (max-width: 768px) {
            .dashboard {
                grid-template-columns: 1fr;
            }

            header h1 {
                font-size: 2rem;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <header>
        <h1><i class="fas fa-chart-line"></i> 用户{{ $user->telephone }}数据列表</h1>
        <p>{{$user->name}}  数据:</p>
        <p>父级关系</p>
        @foreach($Ancestors as $Ancestor)
            <i>{{$Ancestor['name']}}</i>
            <a href="/getUserData/{{$Ancestor['id']}}">{{$Ancestor['telephone']}}</a>
            <i>--></i>
        @endforeach
        <i>{{$user->name}} {{ $user->telephone }}</i>
    </header>

    <div class="dashboard">
        <!-- 钱包积分通证卡片 -->
        <div class="card">
            <div class="card-header">
                <i class="fas fa-wallet"></i>
                <h2>钱包 & 积分 & 通证</h2>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-coins"></i> 积分</div>
                <div class="data-value">{{ $UserAccountAmount['point'] }}</div>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-seedling"></i> 通证</div>
                <div class="data-value">{{ $UserAccountAmount['bean'] }}</div>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-piggy-bank"></i> 钱包</div>
                <div class="data-value">{{ $UserAccountAmount['wallet'] }}</div>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-gift"></i> 奖励余额</div>
                <div class="data-value">{{ $UserAccountAmount['reward'] }}</div>
            </div>
        </div>

        <!-- 充值卡片 -->
        <div class="card">
            <div class="card-header">
                <i class="fas fa-money-bill-wave"></i>
                <h2>充值</h2>
            </div>
            <div style="text-align: center; padding: 30px 0;">
                <div style="font-size: 2.5rem; font-weight: 700; color: #27ae60;">
                    {{ $getUserRecharge }}
                </div>
                <p style="color: #7f8c8d; margin-top: 10px;">总充值金额</p>
            </div>
        </div>

        <!-- 拼团释放通证卡片 -->
        <div class="card">
            <div class="card-header">
                <i class="fas fa-users"></i>
                <h2>拼团释放通证</h2>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-cubes"></i> 总量 </div>
                <div class="data-value">{{ $getKcInfo['total'] }}</div>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-sync-alt"></i> 已释放</div>
                <div class="data-value">{{ $getKcInfo['release'] }}</div>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-hourglass-half"></i> 待释放 </div>
                <div class="data-value">{{ $getKcInfo['released'] }}</div>
            </div>

            <div class="chart-container">
                <canvas id="releaseChart"></canvas>
            </div>
        </div>

        <!-- 消费卡片 -->
        <div class="card">
            <div class="card-header">
                <i class="fas fa-shopping-cart"></i>
                <h2>消费</h2>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-box"></i> 商品消费 </div>
                <div class="data-value">{{ $consumption['product'] }}</div>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-user-friends"></i> 拼团消费 </div>
                <div class="data-value">{{ $consumption['group'] }}</div>
            </div>

            <div class="stats-grid">
                <div class="stat-card">
                    <div class="stat-label">总消费</div>
                    <div class="stat-value">{{$consumption['total']}}</div>
                    <div class="stat-label">商品 + 拼团</div>
                </div>
                <div class="stat-card">
                    <div class="stat-label">拼团占比</div>
                    <div class="stat-value">%{{ $consumption['proportion'] }}</div>
                    <div class="stat-label">占消费总额</div>
                </div>
            </div>
        </div>

        <!-- 流水卡片 -->
        <div class="card">
            <div class="card-header">
                <i class="fas fa-water"></i>
                <h2>流水</h2>
            </div>
            <h3 style="margin: 15px 0 10px; color: #3498db;">钱包流水</h3>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-arrow-right"></i> 奖励余额转入</div>
                <div class="data-value">{{ $transfer['in']}}</div>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-arrow-left"></i> 转到奖励余额</div>
                <div class="data-value">{{ $transfer['out']}}</div>
            </div>
            <div class="data-item">
                <div class="data-label"><i class="fas fa-search-dollar"></i> 求购</div>
                <div class="data-value">{{ $transfer['seeking']}}</div>
            </div>

{{--            <h3 style="margin: 20px 0 10px; color: #3498db;">奖励流水</h3>--}}
{{--            <div style="padding: 15px; background: #f8f9fa; border-radius: 8px; text-align: center; color: #7f8c8d;">--}}
{{--                <i class="fas fa-info-circle"></i> 暂无奖励流水记录--}}
{{--            </div>--}}
        </div>
    </div>

    <footer>
        <p>最后更新时间:{{ $now }} </p>
                    </footer>
                </div>

                <script>

                    // 添加动画效果
                    document.addEventListener('DOMContentLoaded', function () {
                        const cards = document.querySelectorAll('.card');
                        cards.forEach(card => {
                            card.style.opacity = '0';
                        });

                        setTimeout(() => {
                            cards.forEach((card, index) => {
                                setTimeout(() => {
                                    card.style.animation = 'fadeInUp 0.5s ease forwards';
                                }, index * 150);
                            });
                        }, 300);
                    });
                </script>
</body>
</html>
